<?php

namespace app\controllers\admin\uni\system;

use app\controllers\admin\AdminController;
use app\models\system\SetApp as Model;

class AppController extends AdminController
{
    public function actionFetch()
    {
        $model = Model::getLastOne();

        return $this->success($model);
    }

    public function actionSave()
    {
        $data = $this->post();

        // create time
        $data['create_time'] = date('Y-m-d H:i:s', strtotime($data['create_time']));

        if (Model::saveData($data)) {
            return $this->success();
        }

        return $this->fail();
    }

}